package com.rg1906.web;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.rg1906.service.impl.UpdateStudentScoreServiceImpl;


@WebServlet("/UpdateStudentScore")
public class UpdateStudentScore extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	UpdateStudentScoreServiceImpl service=new UpdateStudentScoreServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String realname = request.getParameter("realname");
		String studentNum = request.getParameter("studentNum");
		String id=request.getParameter("id");
		String gradeClass = request.getParameter("gradeClass");
		String ChineseScore = request.getParameter("ChineseScore");
		String MathScore = request.getParameter("MathScore");
		String EnglishScore = request.getParameter("EnglishScore");
		String ChemistryScore = request.getParameter("ChemistryScore");
		String PhysicsScore = request.getParameter("PhysicsScore");
		String BiologyScore = request.getParameter("BiologyScore");
		try {
			int i1 = service.updateChineseScore(studentNum,ChineseScore);
			int i2 = service.updateMathScore(studentNum,MathScore);
			int i3 = service.updateEnglishScore(studentNum,EnglishScore);
			int i4 = service.updateChemistryScore(studentNum,ChemistryScore);
			int i5 = service.updatePhysicsScore(studentNum,PhysicsScore);
			int i6 = service.updateBiologyScore(studentNum,BiologyScore);
			if(i1>0&&i2>0&&i3>0&&i4>0&&i5>0&&i6>0) {
				response.getWriter().print(true);
			}else {
				response.getWriter().print(false);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
